﻿<Button x:Class="CloseButton"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300" Background="Transparent">
    <Button.Template>
        <ControlTemplate TargetType="{x:Type Button}">
            <Border Name="HostBorder" BorderThickness="0" CornerRadius="4" Background="{TemplateBinding Background}">
                <Grid>
                    <ContentPresenter Margin="0,2,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    <Rectangle>
                        <Rectangle.Fill>
                            <VisualBrush>
                                <VisualBrush.Visual>
                                    <Polygon Name="Cross" Fill="Gray">
                                        <Polygon.Points>
                                            <Point X="20" Y="5"/>
                                            <Point X="5" Y="20"/>
                                            <Point X="45" Y="60"/>
                                            <Point X="5" Y="100"/>
                                            <Point X="20" Y="115"/>
                                            <Point X="60" Y="75"/>
                                            <Point X="100" Y="115"/>
                                            <Point X="115" Y="100"/>
                                            <Point X="75" Y="60"/>
                                            <Point X="115" Y="20"/>
                                            <Point X="100" Y="5"/>
                                            <Point X="60" Y="45"/>
                                        </Polygon.Points>
                                    </Polygon>
                                </VisualBrush.Visual>
                            </VisualBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter TargetName="Cross" Property="Fill">
                        <Setter.Value>
                            <SolidColorBrush Color="Red"/>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter TargetName="Cross" Property="Fill">
                        <Setter.Value>
                            <SolidColorBrush Color="DarkRed"/>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Button.Template>
</Button>
